package com.sangeng.controller;


import com.sangeng.service.ArticleService;
import com.sangeng.domain.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 文章表(Article)表控制层
 *
 * @author makejava
 * @since 2023-06-27 12:13:25
 */
@RestController
@RequestMapping("/article")
public class ArticleController {

        @Autowired
        private ArticleService articleService;

        @GetMapping("/hotArticleList")
        public ResponseResult hotArticleList(){

                return articleService.hotArticleList();
        }

/**
 * 分页查询
 *
 * @param pageNum 页数
 * @param pageSize 每页数量
 * @param categoryId 筛选条件
 * @return 查询结果
 */

   @GetMapping("/articleList")
   public ResponseResult articleList(  Integer pageNum,  Integer pageSize,Long  categoryId){
          return articleService.articleList(pageNum,pageSize, categoryId);
        }


   @GetMapping("/{id}")
   public ResponseResult getArticleDetail(@PathVariable("id") Long id) {
         return articleService.getArticleDetail(id);
}

}